﻿
//创建时间: 2010-12-14
//创建作者: 李晓忠
//功能说明: 广告点击统计
//最后修改: 2010-12-14
using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using TRPOP.Common;
using TRPOP.CMS.Web.UI;


using TRPOP.CMS.Business;
using TRPOP.CMS.Model;

using System.Data;
using System.Text;
using System.Collections;
using Newtonsoft.Json;

namespace TRPOP.CMS.Web.Admin
{
    public partial class advertisement_hits : BaseAdmin
    {
        #region 当前页面权限验证
        protected override void SubPageInit()
        {
            base.m_strPagePermissionExtraKey = "Plugin_Advertisement";
        }
        #endregion

        #region 页面变量
        protected string m_title = "广告点击统计";
        protected int intAdID = 0;
        protected string strBeginTime = "";
        protected string strEndTime = "";
        protected string strIP = "";
        protected int m_intRecordCount = 0;
        protected AdvshitManage mAdvshitManage = new AdvshitManage();
        #endregion


        #region 页面事件

        protected void Page_Load(object sender, EventArgs e)
        {

            intAdID = RequestHelper.RequestInt("adid", 0);
            strBeginTime = RequestHelper.RequestString("begintime");
            strEndTime = RequestHelper.RequestString("endtime");
            strIP = RequestHelper.RequestString("ip");
            if (!IsPostBack)
            {
                LoadBase();
                BindData();
            }
        }
        protected void btSearch_Click(object sender, EventArgs e)
        {
            string parm = "";
            if (adid.Text != "")
            {
                parm += "adid=" + adid.Text;
            }

            if (txtAddTimeBegin.Text != "")
            {
                parm += "&begintime=" + txtAddTimeBegin.Text.Trim();
            }
            if (txtAddTimeEnd.Text != "")
            {
                parm += "&endtime=" + txtAddTimeEnd.Text.Trim();
            }
            if (txtIP.Text != "")
            {
                parm += "&ip=" + txtIP.Text.Trim();
            }


            base.Redirect("advertisement_hits.aspx?" + parm);
        }
        #endregion

        #region 页面方法
        void LoadBase()
        {

            adid.Text = intAdID.ToString();
            txtAddTimeBegin.Text = strBeginTime;
            txtAddTimeEnd.Text = strEndTime;
            txtIP.Text = strIP;
        }


        void BindData()
        {

            DateTime dtBeginTime, dtEndTime;
            dtBeginTime = strBeginTime.ToDateTime();
            dtEndTime = strEndTime.ToDateTime();
            if (Pager.PageSize <= 0) { Pager.PageSize = SYSConfig.SystemVar_AdminContentPageNum; }
            rptList.DataSource = mAdvshitManage.GetListByAdID(intAdID, dtBeginTime, dtEndTime, strIP, Pager.CurrentPage, Pager.PageSize, out m_intRecordCount);
            Pager.ShowRecordCount = true;
            Pager.ShowPageSize = true;
            Pager.ShowCurrentPage = true;
            Pager.RecordCount = m_intRecordCount;
            rptList.DataBind();
        }
        #endregion
    }
}
